package com.caipin.controller;

/**
 * @Author: zhunian0322@163.com
 * @DateTime: 2021-09-30 9:18
 * @Description: TODO
 */
@RestController
@RequestMapping({"/schoolroomHomePageManagement"})
public class AICourseHomePageManagementController {
    @Autowired
    private AICourseHomePageManagementService aiCourseHomePageManagementService;

    @GetMapping({"/invasionWarning"})
    public Object getInvasionWarning(@RequestParam Integer count) {
        List<InvasionWarning> warningList = this.aiCourseHomePageManagementService.getInvasionWarning(count);
        return ResultJson.ok(warningList);
    }

    @GetMapping({"/realTimeAttendance"})
    public Object getRealTimeAttendance() {
        List<RealTimeAttendance> realTimeAttendanceList = new ArrayList<>();
        realTimeAttendanceList.add(new RealTimeAttendance(", Double.valueOf(98.0D)));
                realTimeAttendanceList.add(new RealTimeAttendance(", Double.valueOf(88.0D)));
                        realTimeAttendanceList.add(new RealTimeAttendance(", Double.valueOf(88.0D)));
                                realTimeAttendanceList.add(new RealTimeAttendance(", Double.valueOf(88.0D)));
                                        realTimeAttendanceList.add(new RealTimeAttendance(", Double.valueOf(88.0D)));
        return ResultJson.ok(realTimeAttendanceList);
    }

    @GetMapping({"/abnormalResultsRotationChart"})
    public Object getAbnormalResultsRotationChart() {
        List<AbnormalResultsRotationChart> abnormalResultsRotationChartList = this.aiCourseHomePageManagementService.getAbnormalResultsRotationChart();
        return ResultJson.ok(abnormalResultsRotationChartList);
    }

    @GetMapping({"/abnormalResultsClassroom"})
    public Object getAbnormalResultsClassroom() {
        List<AbnormalResultsClassroom> abnormalResultsClassroomList = null;
        abnormalResultsClassroomList = this.aiCourseHomePageManagementService.getAbnormalResultsClassroom();
        return ResultJson.ok(abnormalResultsClassroomList);
    }

    @GetMapping({"/rankingTeacherList"})
    public Object getRankingTeacherList() {
        List<RankingTeacher> rankingTeacherList = this.aiCourseHomePageManagementService.getRankingTeacherList();
        return ResultJson.ok(rankingTeacherList);
    }

    @GetMapping({"/rankingClbumList"})
    public Object getRankingClbumList() {
        List<RankingClbum> rankingClbumList = this.aiCourseHomePageManagementService.getRankingClbumList();
        return ResultJson.ok(rankingClbumList);
    }

    @GetMapping({"/statisticsOfSchoolAttendance/{unit}"})
    public Object getStatisticsOfSchoolAttendance(@PathVariable("unit") String unit) {
        if (StringUtils.isEmpty(unit))
            return ResultJson.failure(ResultCode.BAD_REQUEST);
        SchoolStatistics statistics = null;
        if (StringUtils.equals(unit, "now")) {
            statistics = this.aiCourseHomePageManagementService.getStatisticsOfSchoolAttendanceForNow();
        } else if (StringUtils.equals(unit, "today")) {
            statistics = this.aiCourseHomePageManagementService.getStatisticsOfSchoolAttendanceForToday();
        } else if (StringUtils.equals(unit, "week")) {
            statistics = this.aiCourseHomePageManagementService.getStatisticsOfSchoolAttendanceForWeek();
        } else {
            return ResultJson.failure(ResultCode.BAD_REQUEST);
        }
        return ResultJson.ok(statistics);
    }

    @GetMapping({"/raiseHandsStatistics"})
    public Object getRaiseHandsStatistics(@RequestParam("unit") String unit) {
        List<RaiseHandsStatistics> raiseList = null;
        if (StringUtils.isEmpty(unit))
            return ResultJson.failure(ResultCode.BAD_REQUEST);
        if (StringUtils.equals(unit, "day")) {
            raiseList = this.aiCourseHomePageManagementService.getRaiseHandsStatisticsForDay();
        } else if (StringUtils.equals(unit, "week")) {
            raiseList = this.aiCourseHomePageManagementService.getRaiseHandsStatisticsForWeek();
        } else if (StringUtils.equals(unit, "month")) {
            raiseList = this.aiCourseHomePageManagementService.getRaiseHandsStatisticsForMonth();
        }
        return ResultJson.ok(raiseList);
    }

    @GetMapping({"/attendanceStatistics"})
    public Object getAttendanceStatistics(@RequestParam("unit") String unit) {
        List<AttendanceStatistics> attendanceList = null;
        if (StringUtils.isEmpty(unit))
            return ResultJson.failure(ResultCode.BAD_REQUEST);
        if (StringUtils.equals(unit, "day")) {
            attendanceList = this.aiCourseHomePageManagementService.getAttendanceStatisticsForDay();
        } else if (StringUtils.equals(unit, "week")) {
            attendanceList = this.aiCourseHomePageManagementService.getAttendanceStatisticsForWeek();
        } else if (StringUtils.equals(unit, "month")) {
            attendanceList = this.aiCourseHomePageManagementService.getAttendanceStatisticsForMonth();
        }
        return ResultJson.ok(attendanceList);
    }

    @GetMapping({"/walkAroundStatistics"})
    public Object getWalkAroundStatistics(@RequestParam("unit") String unit) {
        List<WalkAroundStatistics> walkAroundList = null;
        if (StringUtils.isEmpty(unit))
            return ResultJson.failure(ResultCode.BAD_REQUEST);
        if (StringUtils.equals(unit, "day")) {
            walkAroundList = this.aiCourseHomePageManagementService.getWalkAroundStatisticsForDay();
        } else if (StringUtils.equals(unit, "week")) {
            walkAroundList = this.aiCourseHomePageManagementService.getWalkAroundStatisticsForWeek();
        } else if (StringUtils.equals(unit, "month")) {
            walkAroundList = this.aiCourseHomePageManagementService.getWalkAroundStatisticsForMonth();
        }
        return ResultJson.ok(walkAroundList);
    }

    @GetMapping({"/sleepStatistics"})
    public Object getSleepStatistics(@RequestParam("unit") String unit) {
        List<SleepStatistics> sleepList = null;
        if (StringUtils.isEmpty(unit))
            return ResultJson.failure(ResultCode.BAD_REQUEST);
        if (StringUtils.equals(unit, "day")) {
            sleepList = this.aiCourseHomePageManagementService.getSleepStatisticsForDay();
        } else if (StringUtils.equals(unit, "week")) {
            sleepList = this.aiCourseHomePageManagementService.getSleepStatisticsForWeek();
        } else if (StringUtils.equals(unit, "month")) {
            sleepList = this.aiCourseHomePageManagementService.getSleepStatisticsForMonth();
        }
        return ResultJson.ok(sleepList);
    }
}

